import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from basic import *


ts1 = np.loadtxt('../data/pr_NY.csv')
ts2 = np.loadtxt('../data/tas_NY.csv')

scaler = StandardScaler()
ts1 = scaler.fit_transform(ts1.reshape(-1, 1))
ts2 = scaler.fit_transform(ts2.reshape(-1, 1))

fig = plt.figure(figsize=(10, 6))
plt.subplot(2, 1, 1)


plt.plot(ts1, label='pr')
plt.plot(ts2, label='tas')

plt.plot([400, 500], [-2, -2], 'k-', lw=2)
plt.plot([400, 500], [3, 3], 'k-', lw=2)
plt.plot([400, 400], [-2, 3], 'k-', lw=2)
plt.plot([500, 500], [-2, 3], 'k-', lw=2)
plt.xlabel('Time')
plt.ylabel('Amp')
plt.legend()
plt.subplot(2, 1, 2)
plt.plot(ts1[400:500], label='pr')
plt.plot(ts2[400:500], label='tas')
plt.xticks(np.arange(0, 101, 20), range(400, 501, 20))
plt.xlabel('Time')
plt.ylabel('Amp')
plt.legend()
plt.tight_layout()
plt.savefig(PATH+'results/data.pdf', format='pdf')
plt.show()